package cn.fbs.enums;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

@JsonDeserialize(using = BaseEnumDeserializer.class)
@JsonSerialize(using = BaseEnumSerializer.class)
public interface BaseEnum {

    /**
     * @description：必须在子类的重写方法返回具体的枚举name  ，例如return this.name()<br/>
     * @author： Binz
     */
    String getCode();

    String getDisplayName();

    static <E extends Enum<E>> BaseEnum valueOf(String enumCode,Class<E> clazz) {
        BaseEnum enumm = (BaseEnum) Enum.valueOf(clazz, enumCode);
        return enumm;
    }
}